<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="content">
        <h:panelGroup >
            <h:form  >
                
                <h:commandLink action="/inward/inward_administration" type="reset" >
                    <p:graphicImage library="image" name="back.jpg" styleClass="backButton"></p:graphicImage>
                </h:commandLink>
                
                <p:growl autoUpdate="true" />
                <p:focus id="selectFocus" context="gpSelect" />
                <p:focus id="detailFocus" context="gpDetail" />


                <p:panel header="Manage Room Charges" styleClass="alignTop" >
                    
                    <h:panelGrid id ="gpVeda" columns="2" >

                        <h:panelGrid id="gpSelect" columns="1"  >
                            <p:panel >
                                <h:panelGrid id="gpSelectText" >
                                    <h:selectOneListbox converter="fac"  id="lstSelect"   size="10" value="#{roomFacilityChargeController.current}" style="min-width: 223px">
                                        <f:selectItems  value="#{roomFacilityChargeController.items}" var="myItem" itemValue="#{myItem}" itemLabel="#{myItem.name}" ></f:selectItems>
                                        <f:ajax render="gpDetail" execute="lstSelect" >
                                        </f:ajax>
                                    </h:selectOneListbox>
                                </h:panelGrid>
                                <h:panelGrid id="gpSelectButtons" columns="3"  >
                                    <p:commandButton ajax="false" id="btnAdd" value="Add" action="#{roomFacilityChargeController.prepareAdd()}" styleClass="buttons" onclick="onSubmitButton();"  >
                                    </p:commandButton>

                                    <p:commandButton process="@this" update="@all" id="btnDelete" onclick="if (!confirm('Are you sure you want to delete this record?'))
                                                return false;" action="#{roomFacilityChargeController.delete()}"  value="Delete"  >
                                    </p:commandButton>
                                </h:panelGrid>
                            </p:panel>
                        </h:panelGrid  >

                        <p:panel>
                            <h:panelGrid id="gpDetail" columns="1">
                                <h:panelGrid id="gpDetailText" columns="2">
                                    <h:outputText id="lblName" value="Name" ></h:outputText>
                                    <h:inputText autocomplete="off" id="txtName" value="#{roomFacilityChargeController.current.name}"  ></h:inputText>
                                    <h:outputLabel value="Room Facility"/>
                                    <h:selectManyCheckbox  value="#{roomFacilityChargeController.current.roomFacilities}">
                                        <f:selectItems value="#{roomFacilityChargeController.roomFacilitys}"/>
                                    </h:selectManyCheckbox>
                                    <h:outputLabel value="Room"/>
                                    <h:selectOneMenu value="#{roomFacilityChargeController.current.room}">
                                        <f:selectItem itemLabel="Select Room"/>
                                        <f:selectItems value="#{roomController.items}" var="r" itemLabel="#{r.name}" itemValue="#{r}"/>
                                    </h:selectOneMenu>
                                    <h:outputLabel value="Room Category"/>
                                    <h:selectOneMenu value="#{roomFacilityChargeController.current.roomCategory}">
                                        <f:selectItem itemLabel="Select Room Category"/>
                                        <f:selectItems value="#{roomCategoryController.items}" var="r" itemLabel="#{r.name}" itemValue="#{r}"/>
                                    </h:selectOneMenu>
                                    <h:outputLabel value="Department"/>
                                    <p:autoComplete value="#{roomFacilityChargeController.current.department}" 
                                                    forceSelection="true"
                                                    completeMethod="#{departmentController.completeDept}" 
                                                    var="c" itemLabel="#{c.name}" itemValue="#{c}" >
                                    </p:autoComplete>
                                    <h:outputLabel value="Duration Hour"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.timedItemFee.durationHours}"/>
                                    <h:outputLabel value="Over Shoot Hour"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.timedItemFee.overShootHours}"/>
                                    <h:outputLabel value="Administration Charge"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.adminstrationCharge}"/>
                                    <h:outputLabel value="Madical Care Charge"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.medicalCareCharge}"/>
                                    <h:outputLabel value="Room Charge"></h:outputLabel>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.roomCharge}"/>
                                    <h:outputLabel value="Maintanace Charge"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.maintananceCharge}"/>
                                    <h:outputLabel value="Nursing Charge"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.nursingCharge}"/>
                                    <h:outputLabel value="Duration Days For Mo Charge" rendered="#{sessionController.currentPreference.inwardMoChargeCalculateInitialTime}"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.timedItemFee.durationDaysForMoCharge}" rendered="#{sessionController.currentPreference.inwardMoChargeCalculateInitialTime}"/>
                                    <h:outputLabel value="MO Charge" />
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.moCharge}"/>
                                    <h:outputLabel value="Charge for After Duration Days" rendered="#{sessionController.currentPreference.inwardMoChargeCalculateInitialTime}"/>
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.moChargeForAfterDuration}" rendered="#{sessionController.currentPreference.inwardMoChargeCalculateInitialTime}"/>
                                    <h:outputLabel value="Linen Charge Per Day" />
                                    <h:inputText autocomplete="off" value="#{roomFacilityChargeController.current.linenCharge}"/>

                                </h:panelGrid>
                                <h:panelGrid id="gpDetailButtons" columns="2">
                                    <p:commandButton ajax="false" id="btnSave" value="Save" action="#{roomFacilityChargeController.saveSelected()}" styleClass="buttons" onclick="onSubmitButton();" >

                                    </p:commandButton>
                                    <p:defaultCommand target="btnSave"/>
                                </h:panelGrid>
                            </h:panelGrid>
                        </p:panel>
                    </h:panelGrid>
                </p:panel>
            </h:form>

        </h:panelGroup>

    </ui:define>

</ui:composition>
